Repository navigation
Wait for a header or an element value before a run starts - #61
Merged
Merged
Conversation
JourneyPreconditions.WaitAsync opens a page in a fresh context until a response header, or an element's text or attribute, shows a value (exact, contains or regex), within a timeout, looking every interval, and giving up when looks that fail exceed the retries. The run's allow list, user agent, headers and read-only rule apply. Page.Response exposes the status and headers of the main document. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Mpdreamz
added a commit
that referenced
this pull request
Nov 17, 2026
Main CI failed on ubuntu after #61: `LooksThatFailAreRetriedAndGiveUpAfterTheRetries` hung the first looks for 3 s and relied on a 400 ms navigation timeout. A slow runner exceeded that for the looks that should have worked, so all three looks failed. The test server now starts late, or never. Until it starts, the port refuses connections, so a look fails at once on any machine. The retry and give-up checks are the same; the give-up case also asserts the refused-connection error. I ran the precondition tests three times locally, all green. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Sonnet 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A post-deploy run against a live site can start before the deploy shows: the old build still answers, or the cache has not cleared. Journeys then fail one by one, or a stalled navigation looks like a regression. Waiting for the site to show the expected build first turns that into one clear failure, and it also flags a deploy that went through but did not land.
What
JourneyPreconditions.WaitAsync(browser, precondition, options)opens a page until a response header, or an element's text or attribute, shows a value (exact, contains or regex).Timeout(default 10 s) bounds the wait andInterval(500 ms) spaces the looks.Retries(default 2) counts looks that fail, such as a page that did not load or a dropped connection. A look that works and shows another value is not an error, so the wait goes on untilTimeout.Page.Responsegives the status and headers of the response that served the current document, from theNetworkevents pages already collect.The result says what was expected and what was last seen. DECISIONS.md and the network docs describe it, including that a value shared by two deploys passes at once.
Verification
Full suite passes (528). Nine new live tests: header and element values that change late, text, regex and contains, never arriving, missing header and element, retries recovering and giving up, a host outside the allow list, bad input. I broke the retry limit and the contains match and each made the matching tests fail; restored.
🤖 Generated with Claude Code